# To change this template, choose Tools | Templates
# and open the template in the editor.

__author__="Administrator"
__date__ ="$2011-4-8 15:34:40$"
import logging
import sys
class customLogger():
    '''
    custom logging class
    '''
    _logHandle = None
    _logger = None
    showInfo = False
    def __init__(self,LoggerName,LoggerFile):
        self._logger = logging.getLogger(LoggerName)
        self._logHandle = logging.FileHandler(LoggerFile,'a')
        self._logHandle.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s     %(filename)s   line:%(lineno)d'))
        self._logger.addHandler(self._logHandle)
    def logError(self,Info=None):
        if Info is None:
            Info = 'Error Info'
        if self.showInfo == True:
            print Info
        self._logger.error(Info)
    def __del__(self):
        self._logger = None
        self._logHandle = None
